package com.accenture.portal.service.access.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.accenture.portal.dao.access.AccessMapper;
import com.accenture.portal.model.access.Access;
import com.accenture.portal.service.access.AccessService;

@Service
public class AccessServiceImpl implements AccessService {

	@Autowired
	private AccessMapper accessMapper;

	/* Json */
	@Override
	public List<Access> SearchAllAccess() {
		List<Access> accessList = accessMapper.searchAllAccess();
//		new JSONArray();
//		return JSONArray.fromObject(accessList).toString();
		return accessList;
	}

	/*all access string*/
	@Override
	public List<Access> SearchAllAccessStr() {
		List<Access> accessList = accessMapper.searchAllAccessStr();
		return accessList;
	}
	
	/*add*/
	@Override
	public void AddAccess(Access access) {
		accessMapper.addAccess(access);
		
	}

	/*update*/
	@Override
	public void UpdateAccess(Access access) {
		accessMapper.updateAccess(access);
		
	}

	@Override
	public Access SearchAccessById(Integer accessId) {
		
		return accessMapper.searchAccessById(accessId);
	}
	
	/*delete*/
	@Override
	public void physicalDeleteAccess(Integer accessId) {
		accessMapper.physicalDeleteAccess(accessId);
		
	}
	
	@Override
	public void logicalDeleteAccess(Integer accessId) {
		accessMapper.logicalDeleteAccess(accessId);
		
	}
	
	/* pagnation */
	/* pagnation */
	@Override
	public List<Access> SearchAllAccessStrPagenation(int start, int end) {
		List<Access> accessList = accessMapper.searchAllAccessStrPagenation(start, end);
		return accessList;
	}
	
	@Override
	public int getTotalCount() {
		return accessMapper.getTotalCount();
	}

}
